package com.xcity.game.equip.suit4.impl;

import com.xcity.game.combat.ActionEffect;
import com.xcity.game.combat.ActionEffect.Value;
import com.xcity.game.combat.attr.CombatAttributeType;
import com.xcity.game.combat.unit.CombatUnit;
import com.xcity.game.common.GameStaticConfig;
import com.xcity.game.equip.suit4.BaseSuit4;
import com.xcity.game.equip.template.EquipSuitEffectTemplate;

/**
 * 阿玛尼4件套<br/>
 * 对生命值低于{30}%的目标造成{50}%额外伤害
 * @author yang.li
 *
 */
public class Suit4Armani extends BaseSuit4 {

	public Suit4Armani(CombatUnit unit, EquipSuitEffectTemplate template) {
		super(unit, template);
	}

	@Override
	public void preDamage0(ActionEffect effect) {
		if (unit.getId() != effect.ref().getUnitId()) {
			return;
		}
		int hpDelta = effect.getHpDelta();
		if (hpDelta < 0 && effect.getUnit().getHp() < effect.getUnit().getMaxHp() * template.getSuit4Param(0) / GameStaticConfig.percentBase) {
			Value v = effect.getValue(CombatAttributeType.HP);
			hpDelta += hpDelta * template.getSuit4Param(1) / GameStaticConfig.percentBase;
			v.setDelta(hpDelta);
		}
	}
	

}
